home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!friend!news
- From: rich@kastle.com (Richard Krehbiel)
- Subject: Re: Is it possible to #include <#defined or -D 'ed macro>?
- Message-ID: <1996Jan25.114826.28115@friend.kastle.com>
- Sender: news@friend.kastle.com (News)
- Reply-To: rich@kastle.com
- Organization: Kastle Development Associates
- X-Newsreader: Forte Free Agent 1.0.82
- References: <5rbuntgqp0.fsf@ritz.mordor.com>
- Date: Thu, 25 Jan 1996 11:48:07 GMT
-
- benjamin@ritz.mordor.com (Joseph Thomas) wrote:
-
- >Does anyone know a way of having an include statement that can include
- >a file, based on a -D <MACRO_NAME> flag passed to the compiler, to
- >give the effect of:
-
-
- >#include <SOURCE>
-
- #include uses either the form
-
- #include "file"
-
- or
-
- #include <file>
-
- The include directive is preprocessed first, so you can write
-
- #include SOURCE
-
- ...and so long as SOURCE is #defined to be in one of the two accepted
- forms, it will work.
-
- I used this exact trick once in an OS/2 project. Getting the quote
- characters as part of the defined symbol from the command line was a
- bit tricky. I ended up with this in my makefile:
-
- $(CC) $(CFLAGS) /DAVL_DATATYPES="\"avl_mem.h\"" /C avlmem.c
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@mnsinc.com (personal)
-
-